﻿using MyAppAPI.Context;
using MyAppAPI.Repositories.interfaceRepo;

namespace MyAppAPI.Repositories
{
    public class UserRepository : IUserRepository
    {
        public UserContext userContext;
        public UserRepository(UserContext userContext)
        {
            this.userContext = userContext;
        }
        public bool ExisUser(string username, string password, ref int userId)
        {
            var userInfo=userContext.User.Where(e=>e.UserName==username&&e.Password==password&&e.IsDel==0).FirstOrDefault(); 
            if (userInfo!=null)
            {
                userId=userInfo.UserId;
                return true;
            }
            return false;
        }
    }
}
